package com.smcaiot.jfttask.north.convert;

import com.smcaiot.jfttask.domain.TaskReceiver;
import com.smcaiot.jfttask.north.message.AddTaskRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @Author: cz
 * @Date: 2023/9/27
 * @Description:
 */
@Mapper
public interface AddTaskReceiverConvert {
    AddTaskReceiverConvert INSTANCE = Mappers.getMapper(AddTaskReceiverConvert.class);

    @Mapping(target = "childTaskReceivers", expression = "java(com.smcaiot.jfttask.north.message.AddTaskRequest.AddTaskReceiver.to(addTaskReceiver.getChildTaskUserList()))")
    TaskReceiver to(AddTaskRequest.AddTaskReceiver addTaskReceiver);

    List<TaskReceiver> to(List<AddTaskRequest.AddTaskReceiver> taskReceivers);
}
